__author__ = 'daihaibin'

class DBTableAssist(object):

    @staticmethod
    def get_db_table_name(table_name):
        return 'kjs_%s' % table_name

class EagleyeAssist(object):
    @staticmethod
    def get_login_url(**kwargs):
        params = EagleyeAssist._set_get_parameters(**kwargs)
        if params:
            return '/eagleye/login/?%s' % params
        return '/eagleye/login/'

    @staticmethod
    def get_bind_url(**kwargs):
        params = EagleyeAssist._set_get_parameters(**kwargs)
        if params:
            return '/eagleye/social/bind/?%s' % params
        return '/eagleye/social/bind/'

    @staticmethod
    def _set_get_parameters(**kwargs):
        param_string = ''
        if kwargs:
            index = 1
            for arg in kwargs:
                param_string += '%s=%s' % (arg, kwargs[arg])
                if len(kwargs) > index != len(kwargs):
                    param_string += '&'
        return param_string

